package com.atguigu.entity;

import com.atguigu.common.enums.SexEnum;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.Version;
import lombok.Data;

import java.util.Date;

@Data
@TableName("t_user")
public class User {
    @TableId(type = IdType.ID_WORKER)
    private Long id;

    private String name;

    private Integer age;

    private String email;

    private SexEnum sex;

    @TableField(fill = FieldFill.INSERT)
    private Date createTime;

    // @TableField(fill = FieldFill.UPDATE)
    @TableField(fill = FieldFill.INSERT_UPDATE) // 新增时也会赋值
    private Date updateTime;

    // 版本号
    @Version
    @TableField(fill = FieldFill.INSERT)
    private Integer version;

    // 逻辑删除
    @TableLogic
    private Boolean deleted;
}
